import React, {Component} from 'react';
import RootView from './RootView';
import ToastView from './ToastView';

import {isEmpty} from '@/utils/utils';

class Toast {
  static LONG = 3000;
  static SHORT = 1500;

  static show(msg, time) {
    if (isEmpty(msg)) {
      return null;
    }
    RootView.setView(
      <ToastView
        message={msg}
        time={time}
        onDismiss={() => {
          RootView.setView();
        }}
      />,
    );
  }
}
global.Toast = Toast;
export default Toast;
